<template>
  <div>
    <a-table 
    :columns="columns" 
    :data-source="teng" 
    :pagination="false"
    >
      <a slot="name" slot-scope="text">{{ text }}</a>
    </a-table>
    <a-pagination 
      v-model="current" 
      :total="data.length" 
      show-less-items 
      @change="gu"
      :pageSize='size' 
      :show-total="total => `当前第 ${current}页 当前页有${teng.length}条数据 总共有${total}条数据`"
      style="float:right"
    />
  </div>
</template>

<script>
const columns = [
  {
    title: "Name",
    dataIndex: "name",
    key: "name",
    scopedSlots: { customRender: "name" },
    width: 200,
  },
  {
    title: "Age",
    dataIndex: "age",
    key: "age",
    width: 80,
  },
  {
    title: "Address",
    dataIndex: "address",
    key: "address 1",
    ellipsis: true,
  },
  {
    title: "Long Column Long Column Long Column",
    dataIndex: "address",
    key: "address 2",
    ellipsis: true,
  },
  {
    title: "Long Column Long Column",
    dataIndex: "address",
    key: "address 3",
    ellipsis: true,
  },
  {
    title: "Long Column",
    dataIndex: "address",
    key: "address 4",
    ellipsis: true,
  },
];

export default {
  data() {
    return {
      data:[
        {
          key: "1",
          name: "John Brown",
          age: 1,
          address: "New York No. 1 Lake Park, New York No. 1 Lake Park",
          tags: ["nice", "developer"],
        },
        {
          key: "2",
          name: "Jim Green",
          age: 2,
          address: "London No. 2 Lake Park, London No. 2 Lake Park",
          tags: ["loser"],
        },
        {
          key: "3",
          name: "Joe Black",
          age: 3,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "4",
          name: "Joe Black",
          age: 4,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "5",
          name: "Joe Black",
          age: 5,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "6",
          name: "Joe Black",
          age: 6,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "7",
          name: "Joe Black",
          age: 7,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "8",
          name: "Joe Black",
          age: 8,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "9",
          name: "Joe Black",
          age: 9,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "10",
          name: "Joe Black",
          age: 10,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "11",
          name: "Joe Black",
          age: 11,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "12",
          name: "Joe Black",
          age: 12,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },

        {
          key: "13",
          name: "Joe Black",
          age: 13,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "14",
          name: "Joe Black",
          age: 14,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "15",
          name: "Joe Black",
          age: 15,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "16",
          name: "Joe Black",
          age: 16,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "17",
          name: "Joe Black",
          age: 17,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "18",
          name: "Joe Black",
          age: 18,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "19",
          name: "Joe Black",
          age: 19,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "20",
          name: "Joe Black",
          age: 20,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
        {
          key: "21",
          name: "Joe Black",
          age: 21,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
          {
          key: "22",
          name: "Joe Black",
          age: 22,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
          {
          key: "23",
          name: "Joe Black",
          age: 23,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
          {
          key: "24",
          name: "Joe Black",
          age: 24,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
          {
          key: "25",
          name: "Joe Black",
          age: 25,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
          {
          key: "26",
          name: "Joe Black",
          age: 26,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
          {
          key: "27",
          name: "Joe Black",
          age: 27,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
          {
          key: "28",
          name: "Joe Black",
          age: 28,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
          {
          key: "29",
          name: "Joe Black",
          age: 29,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
          {
          key: "30",
          name: "Joe Black",
          age: 30,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
          {
          key: "31",
          name: "Joe Black",
          age: 31,
          address: "Sidney No. 1 Lake Park, Sidney No. 1 Lake Park",
          tags: ["cool", "teacher"],
        },
      ],
      columns,
      current: 1,//设置表格的当前页
      total:0,
      teng:[],
      size:15, //设置表格当前页的总数据。
    };
  },
  methods: {
    gu(page,size){
        var jian=JSON.parse(JSON.stringify(this.data))
        var arr2=jian.slice((page-1)*size,page*size)
        this.teng=arr2
    }
  },

  mounted() {
    this.gu(this.current,this.size)
  },
};

</script>

<style>
</style>